package top.xunfong.api.probe.model;

import top.xunfong.api.probe.factory.RemoteProbeFallbackFactory;
import top.xunfong.common.core.constant.SecurityConstants;
import top.xunfong.common.core.constant.ServiceNameConstants;
import top.xunfong.common.core.domain.R;
import top.xunfong.api.probe.domain.dto.ProbeDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;

import java.util.Collection;

@FeignClient(contextId = "remoteProbeService", value = ServiceNameConstants.PROBE_TO_KAFKA_SERVICE, fallbackFactory = RemoteProbeFallbackFactory.class)
public interface RemoteProbeService {

    @PostMapping(value = "/probe/single")
    R<String> sendSingle(@RequestBody ProbeDTO dto, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @PostMapping(value = "/probe/multiple")
    R<String> sendMultiple(@RequestBody Collection<ProbeDTO> dto, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
}
